# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IntegratedGradientsAttribution do
  @moduledoc """
  An attribution method that computes the Aumann-Shapley value taking advantage of the model's fully differentiable structure. Refer to this paper for more details: https://arxiv.org/abs/1703.01365

  ## Attributes

  *   `blurBaselineConfig` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1BlurBaselineConfig.t`, *default:* `nil`) - Config for IG with blur baseline. When enabled, a linear path from the maximally blurred image to the input image is created. Using a blurred baseline instead of zero (black image) is motivated by the BlurIG approach explained here: https://arxiv.org/abs/2004.03383
  *   `smoothGradConfig` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1SmoothGradConfig.t`, *default:* `nil`) - Config for SmoothGrad approximation of gradients. When enabled, the gradients are approximated by averaging the gradients from noisy samples in the vicinity of the inputs. Adding noise can help improve the computed gradients. Refer to this paper for more details: https://arxiv.org/pdf/1706.03825.pdf
  *   `stepCount` (*type:* `integer()`, *default:* `nil`) - Required. The number of steps for approximating the path integral. A good value to start is 50 and gradually increase until the sum to diff property is within the desired error range. Valid range of its value is [1, 100], inclusively.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :blurBaselineConfig =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1BlurBaselineConfig.t() | nil,
          :smoothGradConfig =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1SmoothGradConfig.t() | nil,
          :stepCount => integer() | nil
        }

  field(:blurBaselineConfig,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1BlurBaselineConfig
  )

  field(:smoothGradConfig,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1SmoothGradConfig
  )

  field(:stepCount)
end

defimpl Poison.Decoder,
  for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IntegratedGradientsAttribution do
  def decode(value, options) do
    GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IntegratedGradientsAttribution.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IntegratedGradientsAttribution do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
